<template>
	<view class="container">
		<view class="user-info" v-if="userInvites == null || userInvites.length == 0">
			<view class="user-photo-nick">
				<view class="nick">暂无用户</view>
			</view>
		</view>
		<view class="user-info" v-for="user in userInvites" :key="user.id">
			<view class="user-photo-nick">
				<view>
					<u-image width="60px" height="60px" shape="circle" :lazy-load="true" :src="user.cover == null ? defaultCover : user.cover" :fade="true" duration="450">
					</u-image>
				</view>
				<view class="nick">{{isNull(user.nickName) ? '未授权登录' : user.nickName}}</view>
			</view>
			<view class="user-money-title">
				<view class="title">{{user.createTime}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInvites: null,
				defaultCover:"https://6b69-king-0ggunsy0b288b288-1303887840.tcb.qcloud.la/cps/1582856620918255.jpg"
			}
		},
		onLoad: function(option) {
			this.loadUserInvite();
		},
		methods: {
			//加载用户邀请
			loadUserInvite: function() {
				this.$u.get('/user/invite').then(res => {
					if (res.code != 200) {
						return;
					}
					this.userInvites = res.data;
				});
			}
		}
	}
</script>

<style lang="less">
	page {
		background-color: #f3f3f3;
	}

	.container {
		margin: 10px;
		display: flex;
		flex-direction: column;

		.user-info {
			display: flex;
			flex-direction: row;
			background-color: #FFFFFF;
			border-radius: 10px;
			justify-content: space-between;
			align-content: center;
			align-items: center;
			padding: 10px 15px;
			margin-bottom: 10px;

			.user-photo-nick {
				display: flex;
				flex-direction: row;
				align-content: center;
				align-items: center;

				.nick {
					margin-left: 10px;
					font-size: 15px;
					color: #909399;
				}
			}

			.user-money-title {
				display: flex;
				flex-direction: column;
				align-content: center;
				align-items: center;

				.money {
					font-size: 25px;
					color: red;
				}

				.title {
					font-size: 10px;
					color: #999999;
				}
			}
		}
	}
</style>
